import type { AxiosPromise } from "axios";
import type {
  TaskKey,
  FlowTaskModel,
  TaskReq,
  FlowTaskPage,
} from "../task/types";

import type { EntityApi } from "jmash-core";

// 接口
export interface MonitorTaskApi extends EntityApi {
  getKey(model: FlowTaskModel): TaskKey;
  // 查询流程任务
  findPage(req: TaskReq): AxiosPromise<FlowTaskPage>;
  // 暂停/恢复任务.
  suspendTask(req: FlowSuspendTaskReq): AxiosPromise<boolean>;
}

/**
 * 暂停/恢复任务.
 */
export interface FlowSuspendTaskReq {
  /**
   * 用于检测重复请求的唯一字符串ID.
   */
  requestId?: string;
  /**
   * 任务ID.
   */
  taskId?: string;
  /**
   * 暂停/恢复.
   */
  suspend?: boolean;
}
